package com.training.admin.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.training.admin.entity.trainee.Trainee;
/**
 * 
 * @author Rockett
 *
 */
@Dao("hibernate")
public interface TraineeDao {
	
	/**
	 * 
	 * @param projectId
	 * @return
	 */
	@Query("FROM Trainee WHERE disabled = false and name =:name and code =:code and email =:email")
	public List<Trainee> listByTrainee(@Variable("name") String name,@Variable("code") String code,@Variable("email") String email);

	/**
	 * @param name
	 * @return
	 */
	@Query("FROM Trainee WHERE disabled = false AND name LIKE :name OR email LIKE :email OR mobile LIKE :mobile OR alias LIKE :alias")
    public List<Trainee> listBySearch(@Variable("name") String name, @Variable("email") String email, @Variable("mobile") String mobile, @Variable("alias") String alias);
	
	/**
     * @param email
     * @return
     */
    @Query("FROM Trainee WHERE disabled = false and email =:email")
    public Trainee loadByEmail(@Variable("email") String email);

	/**
	 * @param code
	 * @return
	 */
	@Query("FROM Trainee WHERE disabled = false and code =:code")
    public Trainee loadByCode(@Variable("code") String code);

	/**
	 * @param emails
	 * @return
	 */
	@Query("FROM Trainee WHERE disabled = false and email in (:emails)")
    public List<Trainee> listByEmails(@Variable("emails") List<String> emails);
	
	
}
